package leetcode;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2022-02-04 14:52
 **/
public class LeetCode1725 {
    public int countGoodRectangles(int[][] rectangles) {
        int res = 0;
        int maxLen = 0;
        for (int[] rectangle : rectangles) {
            int l = rectangle[0];
            int w = rectangle[1];
            int min = Math.min(l, w);
            if (min == maxLen) {
                ++res;
            } else if (maxLen < min) {
                maxLen = min;
                res = 1;
            }
        }
        return res;
    }
}
